package cn.tiancaifan.micro.mapper;

import cn.tiancaifan.micro.entity.Hr;
import cn.tiancaifan.micro.entity.Role;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (Hr)表数据库访问层
 *
 * @author makejava
 * @since 2020-04-07 17:18:00
 */
@Repository
public interface HrMapper {

    /**
     * 通过用户明查询用户
     * @param username
     * @return
     */
    @Select("SELECT * FROM hr WHERE username= #{username}")
    Hr loadUserByUsername(String username);

    @Select("select r.* from role r ,hr_role hrr where hrr.rid =r.id and hrr.hrid = #{id}")
    List<Role> getHrRolesByid(Integer id);

    List<Hr> getAllHr(Integer id);

    int updateEnable(Integer uid,Integer eid);

    int deleteHrRole(Integer uid,Integer rid);

    int addHrRole(Integer uid,Integer rid);

    int deleteHrByID(Integer id);
}